<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Message extends CI_Controller {

	function __construct()
	{
		parent::__construct();
	}

	public function show()
	{
		$this->load->model('messagedata_m');
		if(@$_GET['count']==null){
			$_GET['count']=0;
			$count= (integer)($_GET['count']);
		}else{
			$count= (integer)($_GET['count']);}
			$query=$this->messagedata_m->msg_select($count,5);
			foreach ($query->result() as $row){
				$data[]=$row;
			}
			return $data;
	}

	public function get_floor($value){
		$this->load->model('messagedata_m');
		return $this->messagedata_m->msg_getpage($value);
	}

	public function index()
	{
		$data['msg']=$this->show();
		$floor=$this->get_floor(5);
		if($floor[1]!=0){
			$floor[0]++;
		}
		for($i=1;$i<=$floor[0];$i++){
			$data['pages'][]=$i;
		}
			
		$this->load->view('message',$data);
	}
	public function face1()
	{
		$this->load->view('face1');
	}
	public function face2()
	{
		$this->load->view('face2');
	}
	public function testview(){
		$data['msg']=$this->show();
		var_dump($data);
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */